<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<!--作业3：画一个多边形，图片在img文件夹下面-->
<body>
<canvas width="600" height="600" id="can">您的浏览器不支持画布</canvas>
<script type="text/javascript">
    var can=document.getElementById("can");
    var pen=can.getContext("2d");
    pen.beginPath();
    pen.moveTo(100,100);
    pen.lineTo(200,100);
    pen.moveTo(100,100);
    pen.lineTo(70,180);
    pen.moveTo(200,100);
    pen.lineTo(230,180);
    pen.moveTo(70,180);
    pen.lineTo(100,260);
    pen.moveTo(230,180);
    pen.lineTo(200,260);
    pen.moveTo(100,260);
    pen.lineTo(200,260);
    //设置边框的样式
    pen.strokeStyle="red";
    pen.lineWidth="3";
    pen.closePath();
    pen.stroke();
</script>
</body>
</html>